List out of the database

hi

is there anyway to list all the views of the module along with access permissions?


doors@36677 - Thu Oct 06 09:21:54 EDT 2016

Re: List out views in all modules of the database
Mike.Scharnow - Thu Oct 06 09:43:45 EDT 2016

Sure. There are many ways to do this.

Where exactly do you have a problem?

Browsing through all projects / folders / modules has been discussed many times here on the forum, opening a module as read-only should be trivial, browsing through all views of a module is done using the loop 

string sViewname
Module modCurrent = xx
for sViewname in views modCurrent

browsing through access records of a view is done using the loop 

View vCurrent = ..
AccessRec arCurrent
for arCurrent in vCurrent do

For each AccessRec you can get the username and the permissions (see Chapter Access controls in the DXL help).

It might be a bit difficult to resolve inherited access information, but you could start by just printing out the result of 

string isAccessInherited (View v, bool &inherited)

 

Re: List out views in all modules of the database
Mike.Scharnow - Fri Oct 07 09:48:15 EDT 2016

you mixed some concepts and the choice of variable names is not too well. 

1.

- parentItem should be renamed to currentItem, because it this the one item that you currently work with

- name should be renamed to e.g. sName, because "name" is a reserved word.

I recommend working with an editor that is able to understand DXL syntax and keywords, because you will then see that "name" has a different colour than other variable names. Use the Sodius DXL editor or Notepad++ in combination with the UDL provided at http://aps-lab.blogspot.de/2015/01/doors-dxl-language-fileudl-for-notepad.html

 

2.

Your function recurseFolders takes care of ensuring that every item is traversed.

In line 17, the variable parentItem already contains the current Module, so you just need to open the module.

The loop "for m in database" will only iterate over all modules that are already open!

So, instead of lines 17,18,19, do a  m=read(fullName parentItem,false,false)  (or currentItem, if you renamed the variable)

 

3. 

You want to print the access records of the views, not of the module.

So, the loop beginning in line 25 must iterate over a view. Move it inside the loop for sName in views m do {...}.

Also, the loop "for ar in ..." will need a parameter of type View. sName is of type string. So, you have to create a new variable of type View (e.g. vCurrent) and set it with the view command

View vCurrent = view (currentItem, sName)

The rest should just be beautification.

Re: List out views in all modules of the database
doors@36677 - Mon Oct 10 03:16:04 EDT 2016

Mike.Scharnow - Fri Oct 07 09:48:15 EDT 2016

you mixed some concepts and the choice of variable names is not too well. 

1.

- parentItem should be renamed to currentItem, because it this the one item that you currently work with

- name should be renamed to e.g. sName, because "name" is a reserved word.

I recommend working with an editor that is able to understand DXL syntax and keywords, because you will then see that "name" has a different colour than other variable names. Use the Sodius DXL editor or Notepad++ in combination with the UDL provided at http://aps-lab.blogspot.de/2015/01/doors-dxl-language-fileudl-for-notepad.html

 

2.

Your function recurseFolders takes care of ensuring that every item is traversed.

In line 17, the variable parentItem already contains the current Module, so you just need to open the module.

The loop "for m in database" will only iterate over all modules that are already open!

So, instead of lines 17,18,19, do a  m=read(fullName parentItem,false,false)  (or currentItem, if you renamed the variable)

 

3. 

You want to print the access records of the views, not of the module.

So, the loop beginning in line 25 must iterate over a view. Move it inside the loop for sName in views m do {...}.

Also, the loop "for ar in ..." will need a parameter of type View. sName is of type string. So, you have to create a new variable of type View (e.g. vCurrent) and set it with the view command

View vCurrent = view (currentItem, sName)

The rest should just be beautification.

@Mike.Scharnow 7b5f002d-ec81-41ff-8fe5-6c6229d68f63​ : Thanks a lot for the valuable feedback. I have improvised the script as per your suggestions!!!

Re: List out views in all modules of the database
smarti.sj - Mon Oct 10 09:46:03 EDT 2016

doors@36677 - Mon Oct 10 03:16:04 EDT 2016

@Mike.Scharnow 7b5f002d-ec81-41ff-8fe5-6c6229d68f63​ : Thanks a lot for the valuable feedback. I have improvised the script as per your suggestions!!!

You will want to run this script as the Administrator user.  If you don't you will not see private views.